import request from '@/utils/request'

// 查询问卷列表
export function listSurveyQuestionnaire(query) {
  return request({
    url: '/system/survey/list',
    method: 'get',
    params: query
  })
}

// 查询问卷详细
export function getSurveyQuestionnaire(surveyId) {
  return request({
    url: '/system/survey/' + surveyId,
    method: 'get'
  })
}

// 新增问卷
export function addSurveyQuestionnaire(data) {
  return request({
    url: '/system/survey',
    method: 'post',
    data: data
  })
}

// 修改问卷
export function updateSurveyQuestionnaire(data) {
  return request({
    url: '/system/survey',
    method: 'put',
    data: data
  })
}

// 删除问卷
export function delSurveyQuestionnaire(surveyId) {
  return request({
    url: '/system/survey/' + surveyId,
    method: 'delete'
  })
}

// 发布问卷
export function publishSurveyQuestionnaire(surveyId) {
  return request({
    url: '/system/survey/publish/' + surveyId,
    method: 'put'
  })
}

// 结束问卷
export function endSurveyQuestionnaire(surveyId) {
  return request({
    url: '/system/survey/end/' + surveyId,
    method: 'put'
  })
}

// 提交审批
export function submitSurveyApproval(surveyId) {
  return request({
    url: '/system/survey/submit/' + surveyId,
    method: 'put'
  })
}

// 审批问卷
export function approveSurveyQuestionnaire(data) {
  return request({
    url: '/system/survey/approve',
    method: 'put',
    data: data
  })
}

// 查询问题列表
export function listSurveyQuestion(query) {
  return request({
    url: '/system/question/list',
    method: 'get',
    params: query
  })
}

// 查询问题详细
export function getSurveyQuestion(questionId) {
  return request({
    url: '/system/question/' + questionId,
    method: 'get'
  })
}

// 根据问卷ID查询问题
export function getSurveyQuestionBySurveyId(surveyId) {
  return request({
    url: '/system/question/bySurvey/' + surveyId,
    method: 'get'
  })
}

// 新增问题
export function addSurveyQuestion(data) {
  return request({
    url: '/system/question',
    method: 'post',
    data: data
  })
}

// 批量新增问题
export function batchAddSurveyQuestion(data) {
  return request({
    url: '/system/question/batch',
    method: 'post',
    data: data
  })
}

// 修改问题
export function updateSurveyQuestion(data) {
  return request({
    url: '/system/question',
    method: 'put',
    data: data
  })
}

// 删除问题
export function delSurveyQuestion(questionId) {
  return request({
    url: '/system/question/' + questionId,
    method: 'delete'
  })
}

// 查询答卷列表
export function listSurveyAnswer(query) {
  return request({
    url: '/system/answer/list',
    method: 'get',
    params: query
  })
}

// 查询答卷详细
export function getSurveyAnswer(answerId) {
  return request({
    url: '/system/answer/' + answerId,
    method: 'get'
  })
}

// 提交答卷
export function submitSurveyAnswer(data) {
  return request({
    url: '/system/answer/submit',
    method: 'post',
    data: data
  })
}

// 删除答卷
export function delSurveyAnswer(answerId) {
  return request({
    url: '/system/answer/' + answerId,
    method: 'delete'
  })
} 